import torch
class CNN(torch.nn.Module):
    def __init__(self):
        super(CNN,self).__init__()
        self.conv = torch.nn.Sequential(
            #卷积操作，卷积曾
            torch.nn.Conv2d(in_channels=1,out_channels=32,kernel_size = 5,padding = 2),
            #归一化 NB层
            torch.nn.BatchNorm2d(32),
            #激活层 Relu函数
            torch.nn.ReLU(),
            #最大池化
            torch.nn.MaxPool2d(2)
        ) ;

        self.fc = torch.nn.linear(in_features = 14*14*32,out_features = 10)
        #forward层，进行前向传播
    def forward(self,x):
            out = self.conv(x)
            #将图像数据展开成一维
            #输入的张量
            out = out.view(out.size(),[0],-1)
            out = self.fc(out)
            return out